package net.hnjdzy.fengyl.mycontracer;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.view.View;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import net.hnjdzy.fengyl.mycontracer.entity.AddDaily;
import net.hnjdzy.fengyl.mycontracer.entity.Root;
import net.hnjdzy.fengyl.mycontracer.entity.data;
import net.hnjdzy.fengyl.mycontracer.service.ConDataManager;

import static net.hnjdzy.fengyl.mycontracer.service.ConDataManager.root;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Button button=findViewById(R.id.button);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent=new Intent();
                intent.setClass(MainActivity.this,CityList.class);
                startActivity(intent);
            }
        });
    }



   class ReadTask extends AsyncTask<Void,Void, Root>{

    @Override
    protected Root doInBackground(Void... voids) {
        ConDataManager conDataManager=new ConDataManager();
        try{
            return conDataManager.getData();
        }catch (Exception e){
            e.printStackTrace();
            return null;
        }
    }

    @Override
    protected void onPostExecute(Root jsonRoot) {
        refreshUI(jsonRoot);
        root=root;
    }
}



    //刷新数据
    private void refreshUI(Root jsonRoot){
        ContactsContract.Contacts.Data data=root.getData();


        TextView textView=findViewById(R.id.xiancun);

    }
}
